<?php 
require 'config.php';
ob_clean();
$iNews = getValue('iNews');

//Lấy ra tin
$db_news = new db_query('SELECT new_id,new_title,new_date,new_picture,new_teaser,new_detail,new_tags,new_relate,new_link,
                                    new_cat_id,cat_id,cat_name
                                FROM news 
                                LEFT JOIN categories_multi ON cat_id = new_cat_id 
                                WHERE new_id = '.$iNews.'
                                LIMIT 1');
$news = mysql_fetch_assoc($db_news->result);
unset($db_news);
$nums = strpos($news['new_link'],':');
if($nums > 0){
    $url_news = $news['new_link'];
}else{
    $url_news = 'http://'.$news['new_link'];
}
$url_parse = parse_url($url_news);

//update view
$db_update_view = new db_execute('UPDATE news SET new_view = new_view + 1 WHERE new_id = '.$news['new_id']);

//Đưa ra tin đọc nhiều nhất - cùng categories - cách thời điểm truy cập 36 tiếng (tin xem nhiều trong 36 tiếng vừa qua)
$time_view = time() - 36*3600;
$db_list_view = new db_query('SELECT new_id,new_title,new_date,new_picture,new_teaser,new_detail,new_tags,new_relate,new_link,
                                    new_cat_id,cat_id,cat_name
                                FROM news 
                                LEFT JOIN categories_multi ON cat_id = new_cat_id 
                                WHERE new_date >= '.$time_view.' AND new_cat_id = '.$news['new_cat_id'].' AND new_id != '.$news['new_id'].'  AND new_active = 1
                                ORDER BY new_id DESC 
                                LIMIT 10');
$list_view = $db_list_view->resultArray();
unset($db_list_view);
$iCat = getValue('iCat');
$iActive = getValue('iActive','int','GET',0);
?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="vi" lang="vi" xmlns:og="http://ogp.me/ns#" xmlns:fb="https://www.facebook.com/2008/fbml">
<head>
<title><?=trim($news['new_title'])?></title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta name="language" content="vietnamese" />
<meta name="revisit-after" content="1 days" />
<meta content="initial-scale=1, maximum-scale=1.0, minimum-scale=1.0" name="viewport" />
<meta name="AUTHOR" content="Vnupdate" />
<meta name="description" content="<?=$news['new_teaser'] != '' ? trim(htmlspecialchars(cut_string(removeHTML($news['new_teaser']),150),ENT_QUOTES)) : trim(htmlspecialchars(cut_string(removeHTML($news['new_detail']),150),ENT_QUOTES))?>"/>
<meta name="COPYRIGHT" content="Copyright (C) 2012 VnUpdate.net" />
<meta name="ROBOTS" content="INDEX, FOLLOW" />
<meta name="RATING" content="GENERAL" />
<meta property="og:title" content="<?=trim(htmlspecialchars($news['new_title'],ENT_QUOTES))?>" />
<meta property="og:type" content="article" />
<meta property="og:url" content="<?=DOMAIN?><?=$_SERVER['REQUEST_URI']?>" />
<meta property="og:image" content="<?=$news['new_picture']?>" />
<meta property="og:site_name" content="VnUpdate" />
<meta property="og:description" content="<?=$news['new_teaser'] != '' ? trim(htmlspecialchars(cut_string(removeHTML($news['new_teaser']),150),ENT_QUOTES)) : trim(htmlspecialchars(cut_string(removeHTML($news['new_detail']),150),ENT_QUOTES))?>"/>
<meta property="fb:admins" content="100004609203263" />
<meta property="fb:app_id" content="447585838689244"/>
<link rel="canonical" href="<?=DOMAIN.generate_detail_url($news,GetNamecat($news['new_cat_id']))?>" />
<link href="<?=DOMAIN?>/favicon.png" type="image/x-icon" rel="shortcut icon"/>
<link rel="apple-touch-startup-image" media="screen and (max-device-width: 320px)" />  
<link rel="apple-touch-startup-image" media="(max-device-width: 480px) and (-webkit-min-device-pixel-ratio: 2)" /> 
<link rel="apple-touch-startup-image" sizes="640x1096"/>
<link rel="apple-touch-startup-image" sizes="1024x748" media="screen and (min-device-width : 481px) and (max-device-width : 1024px) and (orientation : landscape)" />
<link rel="apple-touch-startup-image" sizes="768x1004" media="screen and (min-device-width : 481px) and (max-device-width : 1024px) and (orientation : portrait)" />
<link rel="apple-touch-startup-image" sizes="1536x2008" media="(device-width: 768px)	and (orientation: portrait)	and (-webkit-device-pixel-ratio: 2)"/>
<link rel="apple-touch-startup-image" sizes="1496x2048" media="(device-width: 768px)	and (orientation: landscape)	and (-webkit-device-pixel-ratio: 2)"/>
<?=$js_global?>
<?=$css_global?>
<script>
  (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){
  (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),
  m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)
  })(window,document,'script','//www.google-analytics.com/analytics.js','ga');

  ga('create', 'UA-43837292-2', 'vnupdate.net');
  ga('send', 'pageview');

</script>
</head>
<body>
    <h1 style="display: none;"><?=$news['new_title']?></h1>
    <div class="all-elements">
        <? include_once('../includes/inc_header.php');?>
        <? include_once('../includes/inc_news_detail.php'); ?>
    </div>
<script type="text/javascript" src="/themes/js/mobile.js"></script>
</body>
</html>
